home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_2 / external < prev    next >
Internet Message Format  |  1995-03-31  |  5KB

  1. From HP-48@VM1.NoDak.EDU Sun Sep  9 19:29:58 1990
  2. Received: from vm1.NoDak.edu by en.ecn.purdue.edu (5.61/1.27jrs)
  3.     id AA08517; Sun, 9 Sep 90 19:29:51 -0500
  4. Message-Id: <9009100029.AA08517@en.ecn.purdue.edu>
  5. Received: from NDSUVM1.BITNET by VM1.NoDak.EDU (IBM VM SMTP R1.2.1MX) with BSMTP id 9042; Sun, 09 Sep 90 19:28:53 CDT
  6. Received: from NDSUVM1.BITNET by NDSUVM1.BITNET (Mailer R2.07) with BSMTP id
  7.  9035; Sun, 09 Sep 90 19:28:51 CDT
  8. Date:         Sun, 9 Sep 90 19:21:00 CST
  9. Reply-To: HP-48 - HP-48sx Hand Held System <HP-48@VM1.NoDak.EDU>
  10. Sender: HP-48 - HP-48sx Hand Held System <HP-48@VM1.NoDak.EDU>
  11. From: TNAN0%ISUVAX.BITNET@VM1.NoDak.EDU
  12. Subject:      Re: Case and Programs
  13. To: Multiple recipients of list HP-48 <HP-48@NDSUVM1>
  14. Status: OR
  15.  
  16. Hello to Jason and the others:
  17.  
  18. Jason asked a question concerning EXTERNALs... I would like to take the time
  19. to explain...
  20.  
  21. The representation inside the HP for ANY object looks like this:
  22.  
  23. [5 nibble address] <5 nibble length> <data>
  24.  
  25. The first five nibbles contain the address of the handling routine inside the
  26. HP-48sx.  For example, a string generates the address: 02A2Ch  This is the
  27. address of the string handler routine.  (if you use the scanner: ON-D <- the
  28. address will appear backward: C2A20h)  If the handler expects more info
  29. (like the string handler does), it is followed by a 5 nibble length.  This
  30. length always includes whatever data exists plus the 5 nibbles used for the
  31. length field itself (eg., a 4 character string generates a length of 13.
  32. 4 bytes * 2 nibbles + 5 nibbles = 13).  Then the data follows.
  33.  
  34. Functions and Commands (like SIN or NEXT) generate only the 5 nibble handler
  35. address.  This is because they require no extra data.
  36.  
  37. Now, what is an EXTERNAL???  Well, when the 48sx looks up the address in a
  38. table (to find out what the real meaning behind 02A2Ch is...)  it may find
  39. an entry (such as SIN or whatever)... But if it does not, it assumes that
  40. the program is just making a machine language jump to an EXTERNAL routine
  41. and so it simply prints EXTERNAL...  Obviously, you can't edit these
  42. EXTERNALS because there is no single number that EXTERNAL translates to.
  43. It simply means "a function that has no name".  In a similar manner,
  44. you can generate CODE onjects... These have the same structure as a string
  45. but are actually a form of inline machine language.  These have the
  46. address 02DCCh, a 5 nibble length, and then a series of machine language
  47. commands.  These will show up as "Code" in a program, but when EVALuated
  48. will execute the machine language inside...   Again, you can't edit these
  49. (probably because HP doesn't want you messing with things that could hurt
  50. your memory).
  51.  
  52. A quick course in externals and code...  PROCEED AT YOUR OWN RISK!
  53.  
  54. Try this...  with nothing in your calculator (clear memory, no libraries,
  55. no memory cards, NOTHING!), generate a string like this: "ABC"
  56. Store this in a variable called 'WOW'.  Now, enter the scanner.  (For
  57. those of you that don't know, the scanner is a built-in way to view and edit
  58. memory directly, so BE CAREFUL!).  To enter the scanner, hold down the ON key
  59. and press D.  You should get two vertical lines, now press the left arrow
  60. (delete key), you should get something similar to this:
  61. 705D9:1B8DA178E5A111B6
  62.  
  63. 705D9 is the address at which your version-printing routine is stored.  To
  64. execute the program at this address, hit EVAL.  You should see:
  65. Version HP48-D
  66. Copyright HP 1989
  67.  
  68. You may get a different version letter (the latest is D)...  Neat huh?  You
  69. can do this several times (since it returns you to the scanner)...
  70. Now, let's take a look at that string we entered!  Press: (and be careful)
  71. ENTER / (that's divide)
  72. The address should now be 00000.  Now press '-' (minus) many times until the
  73. address reads FFFEB.  The display should look like this:
  74. FFFEB:C2A20B0000142434
  75.  
  76. Ok, WOW! look... C2A20... that is the address of the string handler (remember?)
  77. B0000 is the length, in decimal that's 11... (3 bytes * 2 nibbles + 5)
  78. the "142434" is "ABC". "A" is 41 hex (stored backwards, it's "14").
  79. Likewise, B is 42h and C is 43h... Neat, huh???  ok, make sure that your
  80. display starts with C2A20 (after the address and the colon)...  Now, CAREFULLY
  81. type (no need for alpha or shift keys) CCD20.  if you make a mistake, press
  82. '-' (minus) until you get to your mistake and change it.  Ok, now get back to
  83. the calculator mode... Hold down ON and press C.  Now, CAREFULLY press:
  84. VAR BLUE-SHIFT WOW
  85.  
  86. Look! A code object on the stack!  (If you made a mistake typing the number
  87. CCD20, it will show up as an EXTERNAL... try it if you want...)
  88.  
  89. Do NOT evaluate this object (or just press the WOW key) or your calculator
  90. will lock up (you COULD also lose memory... but memory should be empty
  91. before you try this anyway)...  When you are done playing, carefull purge
  92. WOW  ('WOW' PURGE) before you put things back into your calculator...
  93.  
  94. I would have provided a better example, but I am typing this directly
  95. into MAIL and so I do not have an editor to assist me...  If anyone is
  96. interested in a Machine Language "lesson", please show some interest and
  97. I will be happy to provide you with a lesson in writing a useful M/L program.
  98.  
  99. If anything in this message is incorrect, please forgive me.  I have
  100. not had time to go over it and make sure that it is not misleading...
  101.  
  102. ---Xeno  (Gary Snethen)
  103. tnan0@isuvax
  104. tnan0@ccvax.iastate.edu
  105.  
  106.